// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Invisible.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MISCELLANEOUSPROJECT_API UInvisible : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UInvisible();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:
	UFUNCTION(BlueprintCallable, Category = TimeAndSpace)
		void ActivateAbility(UMaterialInterface* SourceMaterial, const TArray<FName> ParameterName);
	UFUNCTION(BlueprintCallable, Category = TimeAndSpace)
		void DeactivateAbility();
private:
	void ResetDissolveStart();
	void ResetDissolveEnd();
	void Start();
	void End();
	void StartDissolve();
	void ReverseDissolve();
private:	
	bool IsDissolving;
	bool IsInvisibleActive;
	float DissolveSpeed;
	float CurrentValue;
	TArray<class UMaterialInterface* > OrignalMaterialArray;
	TArray<class UMaterialInstanceDynamic*> DynamicMaterialarray;
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TimeAndSpace, meta = (AllowPrivateAccess = "true"))
	class UCurveFloat* StartDissolveCurve;
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TimeAndSpace, meta = (AllowPrivateAccess = "true"))
	class UCurveFloat* ReverseDissolveCurve;
	class ACharacter* Character;

	bool OnceStart;
	bool OnceEnd;
	FTimerHandle StartHandle;
	FTimerHandle EndHandle;
	TArray<FName> ParameterName;
};
